﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace _17_ActionFilter
{
    public class MyAcitonFilter : IAsyncActionFilter
    {
        public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            Console.WriteLine("ActionFilter开始执行");
            ActionExecutedContext r = await next();
            if (r.Exception != null)
            {
                Console.WriteLine("ActionFilter发生异常了");
            }
            else {
                Console.WriteLine("ActionFilter执行成功");
            }

        }
    }
}
